class Solution
{
public:
    int preimageSizeFZF(int k)
    {
        long long lower = 1LL;
        long long upper = 5LL * k;
        while (lower < upper)
        {
            long long mid = (lower + upper) / 2;
            int tailZeroCount = f(mid);
            if (tailZeroCount == k)
            {
                return 5;
            }
            else if (tailZeroCount > k)
            {
                upper = mid;
            }
            else
            {
                lower = mid + 1;
            }
        }
        if (f(lower) == k)
        {
            return 5;
        }
        return 0;
    }

    int f(long long n)
    {
        int result = 0;
        while (n)
        {
            n /= 5;
            result += n;
        }
        return result;
    }
};